/**
 * 禁用快捷键
 * 
 * 1.Ctrl+S
 */
import { useEffect } from "react";

export function ShortcutLock() {
  useEffect(() => {
    const handler = (e: KeyboardEvent) => {
      // 禁用 Ctrl+S
      if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "s") {
        e.preventDefault();
        e.stopPropagation();
      }
    };
    window.addEventListener("keydown", handler, true);
    return () => {
      window.removeEventListener("keydown", handler, true);
    };
  }, []);

  return null;
}